package no.ntnu.fp.model;

import java.sql.Timestamp;

import no.ntnu.fp.storage.AlterDB;
import no.ntnu.fp.storage.XMLsave;

public class DeltaR {
	private double value;
	private Timestamp timestamp;
	private int wellID, platformID;
	private AlterDB aDB;
	
	public DeltaR(double rNew, double rPrev, Timestamp lastPoll, int platformID, int wellID){
		value = (rNew - rPrev);
		timestamp = lastPoll;
		this.wellID = wellID;
		this.platformID = platformID;
		aDB = new AlterDB();
		
		try{
			aDB.addDeltaR(this);
		}
		catch(Exception e){
			XMLsave.saveToTemp(this);
		}
		
	}
	
	public double getValue(){
		return value;
	}

	public Timestamp getTimestamp() {
		return timestamp;
	}

	public int getWellID() {
		return wellID;
	}

	public int getPlatformID() {
		return platformID;
	}
}
